{% extends "manage/layout.html" %}

{% set page_title = '添加用户' %}

{% block content %}
<div class="m-content">
    <form class="form-horizontal" method="POST" id="{{ form.__class__.__name__ }}">
		{{ form.hidden_tag() }}
		<fieldset class="fieldset">
			<legend>用户信息</legend>
			{% from "common/_formhelper.html" import render_field %}
			{{ render_field(form.name, class_="form-control", required=True) }}

			{{ render_field(form.password, class_="form-control") }}

			{% from "common/_formhelper.html" import render_select %}
			{{ render_select(form.role) }}

		</fieldset>
		<fieldset>
			<div class="col-sm-offset-2 col-sm-4">
				<button class="btn btn-default">确认</button>
                <a href="{{ url_for('manage.list_users') }}" class="btn btn-default">返回</a>
			</div>
		</fieldset>
	</form>
</div>
{% endblock %}

{% block js %}
{% if form.form_type == 'update' %}
<script>
$(function(){
    $('#password').rules("remove");
});
</script>
{% endif %}
{% endblock %}
